package com.bit.demo;

class Animal {

    int a;   // 默认权限--》包访问权限--》只能在同一个包访问
    protected String name;
    private int data;   //private修饰，可以被子类继承，但在子类中无法访问

    protected Animal(String name) {
        this.name = name;
    }

    protected void eat() {
        System.out.println(this.name + "eat::()");
    }

    protected void sleep() {
        System.out.println(this.name+"sleep::()");
    }
}

class Bird extends Animal{  //继承了父类除了构造方法外的所有属性
    public Bird(String name) {
        super(name);     //先帮助父类构造
    }
}

public class Test {

    public static void main(String[] args) {
        Bird bird = new Bird("LiWei");
        Animal animal = new Animal("LiQia");

        bird.eat();
        bird.sleep();

        System.out.println(bird.name);
        System.out.println(animal.name);
    }

}
